package com.zadtek.shopmall.activities;

import android.content.Intent;
import android.support.v4.app.Fragment;

import com.zadtek.shopmall.base.AbsViewPagerActivity;
import com.zadtek.shopmall.fragments.CouponFragment;
import com.zadtek.shopmall.fragments.RedEnvelopFragment;

import java.util.LinkedList;
import java.util.List;

public class RedEnvelopActivity extends AbsViewPagerActivity {
    public final static String TYPE = "type";
    public final static int TYPE_RED = 1;
    public final static int TYPE_COUPON = 2;
    public final static int TAB_1 = 3;
    public final static int TAB_2 = 4;
    public final static int TAB_3 = 5;

    private int currentType = 1;
    @Override
    public String getTopTitle() {
        String title;
        if(currentType == TYPE_RED){
            title = "红包";
        }else{
            title = "优惠券";
        }
        return title;
    }

    @Override
    protected List<Fragment> getFragments() {
        Intent intent = getIntent();
        currentType = intent.getIntExtra(TYPE,1);
        List<Fragment> list = new LinkedList<>();
        if(currentType == TYPE_RED){
            list.add(RedEnvelopFragment.Instance(TAB_1));
            list.add(RedEnvelopFragment.Instance(TAB_2));
            list.add(RedEnvelopFragment.Instance(TAB_3));
        }else if(currentType == TYPE_COUPON){
            list.add(CouponFragment.Instance(TAB_1));
            list.add(CouponFragment.Instance(TAB_2));
            list.add(CouponFragment.Instance(TAB_3));
        }
        return list;
    }

    @Override
    protected List<String> getTabTitles() {
        List<String> list = new LinkedList<>();
        list.add("未使用");
        list.add("已使用");
        list.add("已过期");
        return list;
    }

}
